﻿using System;
using System.Reactive.Linq;
using SomeRandomGame.Screens;

namespace SomeRandomGame.Achievements
{
    class ThreeSecondsIngameAchievement : IAchievement<long>
    {
        private readonly IScreenManager _screenManager;

        public ThreeSecondsIngameAchievement(IScreenManager screenManager)
        {
            _screenManager = screenManager;
            WhenIsItDone().Subscribe(this);
        }

        public IObservable<long> WhenIsItDone()
        {
            return Observable.Timer(TimeSpan.FromSeconds(3));
        }

        public void OnCompleted()
        {
            _screenManager.AddNotification("3 Seconds ingame! Congratulations!");
        }

        public void OnNext(long value)
        {
            // do nothing
        }

        public void OnError(Exception error)
        {
            // do nothing
        }
    }
}
